package com.f2prateek.rx.preferences3;

import io.reactivex.rxjava3.annotations.NonNull;
import ohos.data.preferences.Preferences;

final class BooleanAdapter implements RealPreference.Adapter<Boolean> {
    static final BooleanAdapter INSTANCE = new BooleanAdapter();

    @NonNull
    @Override
    public Boolean get(@NonNull String key, @NonNull Preferences preferences,
                       @NonNull Boolean defaultValue) {
        return preferences.getBoolean(key, defaultValue);
    }

    @Override
    public void set(@NonNull String key, @NonNull Boolean value,
                    @NonNull Preferences editor) {
        editor.putBoolean(key, value);
    }
}
